<!--
 * @Author: ChunLai
 * @Date: 2022-03-28 18:29:48
 * @LastEditTime: 2025-08-28 20:14:52
 * @Description: 保障责任
 * @FilePath: \02.bldinsure\src\views\index\components\InsurDutyDesc.vue
-->
<template>
  <div class="pd14_lr bg-fff">
    <div class="sy-mode-head">保障责任</div>
    <ol class="item-ol">
      <li class="item-li" v-for="(item, index) in dutysList" :key="index">
        <span class="item-li-l">
          {{ item.dutyName }}
        </span>
        <span class="item-li-r" @click="showDutyItem(item)">
          查看详情
          <span class="ms-row-icon"></span>
        </span>
      </li>
    </ol>
    <div class="item-li-more" @click="showAll = !showAll" v-if="dutysLen > 3">
      全部{{ dutysLen }}项保障
      <span
        class="ml4"
        :class="showAll ? 'ms-row21-icon' : 'ms-row2-icon'"
      ></span>
    </div>

    <PopCommon
      popTitle="保障详情"
      :popShow="showPreModule"
      @callback="showPreModule = false"
    >
      <template v-slot:content>
        <ol class="item-ol pd14_lr">
          <div class="top-tip">
            以下保障内容介绍仅供参考，具体保障责任请以保险条款和保险合同约定为准。
          </div>
          <li class="item-li2">
            <div class="item-li-t">
              <span class="item-li-l flex_1 font3 mr10">
                {{ item.dutyName }}
              </span>
              <span class="item-li-r2" v-if="item.value">
                {{ item.value }}
              </span>
            </div>
            <div class="item-li-b" v-html="item.dutyDescribe"></div>
          </li>
        </ol>
      </template>
    </PopCommon>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  name: "InsureDutyDesc",
  data() {
    return {
      showPreModule: false,
      item: {},
      showAll: false,
    };
  },
  components: {},
  computed: {
    ...mapGetters({
      zeRenList: "page/zeRenList",
    }),
    dutysLen() {
      let res = 0;
      if (this.zeRenList.length > 0) {
        res = this.zeRenList.length;
      }
      return res;
    },
    dutysList() {
      let res = [];
      if (this.zeRenList.length > 0) {
        if (this.showAll) {
          res = this.zeRenList;
        } else {
          res = this.zeRenList.slice(0, 3);
        }
      }
      return res;
    },
  },
  mounted() {},
  methods: {
    showDutyItem(item) {
      this.item = item;
      this.showPreModule = true;
    },
  },
};
</script>

<style lang="less" scoped>
.pd14_lr {
  padding-bottom: 12px;
}
.item-ol {
  display: flex;
  flex-direction: column;

  .item-li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
    font-size: 14px;
    line-height: 22px;
    font-weight: 400;
    border-bottom: 1px dashed #eee;

    .item-li-l {
      width: calc(100% - 130px);
    }

    .item-li-r {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      width: 80px;
      line-height: 18px;
      font-size: 14px;
      color: #747474;
    }
  }

  .item-li2 {
    padding-bottom: 10px;

    &:not(:last-child) {
      border-bottom: 1px dashed #e1e1e1;
    }

    .item-li-t {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      padding: 8px 0;
      // font-size: 12px;

      .item-li-l {
        line-height: 1.3;
        color: #333333;
        // font-weight: 600;
      }

      .item-li-r2 {
        max-width: 36%;
        line-height: 1.3;
        color: #ff8c2c;
      }
    }

    .item-li-b {
      color: #666;
      font-size: 12px;
      line-height: 1.5;
      /deep/strong {
        color: #1b1b1b;
      }
    }
  }
}
.item-li-more {
  display: flex;
  align-items: center;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 19.89px;
  color: #e7a249;
}
.top-tip {
  display: flex;
  color: #ff462c;
  font-size: 12px;
  padding: 0 0 6px 0;
}
</style>
